package com.posjiajia.user.api.controller;

import com.posjiajia.user.core.bo.OrganBo;
import com.posjiajia.user.core.bo.UserBo;
import com.posjiajia.user.core.po.OrganPo;
import com.posjiajia.user.core.utils.BeanTransferUtil;
import com.posjiajia.user.core.vo.OrganVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhenhua.sun
 * @title com.posjiajia.user.api.controller
 * @date 9/17/16
 */
@Controller
@RequestMapping("/organ")
public class OrganController {

    private static final Logger logger = LoggerFactory.getLogger(UserBo.class);

    @Autowired
    private OrganBo organBo;

    @RequestMapping("get")
    @ResponseBody
    public OrganVo getOrganByUserToken(String organId){
        OrganVo organVo = null;
        try {
            OrganPo organPo = organBo.queryByOrganId(Integer.parseInt(organId));
            organVo = BeanTransferUtil.transferType(organPo,OrganVo.class);
        }catch (Exception e){

            logger.error("query organ error",e);
        }
        return organVo;
    }
}
